var express = require('express');
var router = express.Router();

router.all('*', function (req, res, next) {
  res.header('Access-Control-Allow-Origin', '*');
  //Access-Control-Allow-Headers ,可根据浏览器的F12查看,把对应的粘贴在这里就行
  res.header('Access-Control-Allow-Headers', 'Content-Type');
  res.header('Access-Control-Allow-Methods', '*');
  res.header('Content-Type', 'application/json;charset=utf-8');
  next();
});

if (express.uniRouter) {
  express.uniRouter.push({
    name: "首页标签数据",
    type: "get",
    url: "/api/index/topBar"
  });
}
router.get("/api/index/topBar", function (req, res, next) {
  res.send({
    "code": 0,
    "data": {
      type: "topBar",
      list: [
        { id: '1', name: '出租房屋' },
        { id: '2', name: '寻找室友' },
        { id: '3', name: '空闲车位' },
        { id: '4', name: '求租车位' },
        { id: '5', name: '猫狗宠物' },
        { id: '6', name: '二手家具' },
        { id: '7', name: '二手电器' },
        { id: '8', name: '二手玩具' },
        { id: '9', name: '二手书籍' },
        { id: '10', name: '健身卡片' },
        { id: '11', name: '消费卡片' },
        { id: '12', name: '二手小物品' },
        { id: '13', name: '其他物品' }
      ]
    }
  })
});
if (express.uniRouter) {
  express.uniRouter.push({
    name: "首页标签明细",
    type: "get",
    url: "/api/index/topBar/detail"
  });
}
router.get("/api/index/topBar/detail", function (req, res, next) {
  if (req.query.page) { } else {
    req.query.page = 0;
  }
  if (req.query.id && parseInt(req.query.id) < '4' && parseInt(req.query.page) < '4') {
    res.send({
      "code": 0,
      "data": {
        type: "",
        id: req.query.id,
        list: [
          {
            avatar: "/data/my.png",//头像
            username: "用户昵称(" + req.query.page + ")",
            title: "租房",
            totalPrice: "299.00",//总价格
            hopePrice: "299.00",//希望价格
            type: "有房找室友",//类型
            body: "已经找到房屋，找人一起分担",//标题
            position: "",//定位
            address: "",//地址
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page + ")",
            title: "求租",
            type: "无房找室友",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page + ")",
            title: "租房",
            type: "找室友一起租房",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",//头像
            username: "用户昵称(" + req.query.page + ")",
            title: "租房",
            totalPrice: "299.00",//总价格
            hopePrice: "299.00",//希望价格
            type: "有房找室友",//类型
            body: "已经找到房屋，找人一起分担",//标题
            position: "",//定位
            address: "",//地址
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page + ")",
            title: "求租",
            type: "无房找室友",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page + ")",
            title: "租房",
            type: "找室友一起租房",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",//头像
            username: "用户昵称(" + req.query.page + ")",
            title: "租房",
            totalPrice: "299.00",//总价格
            hopePrice: "299.00",//希望价格
            type: "有房找室友",//类型
            body: "已经找到房屋，找人一起分担",//标题
            position: "",//定位
            address: "",//地址
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page + ")98",
            title: "求租",
            type: "无房找室友",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page + ")99",
            title: "租房",
            type: "找室友一起租房",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
        ]
      }
    })
  } else {
    res.json({
    })
  }
});
if (express.uniRouter) {
  express.uniRouter.push({
    name: "我的标签数据",
    type: "get",
    url: "/api/my/topBar"
  });
}
router.get("/api/my/topBar", function (req, res, next) {
  res.send({
    "code": 0,
    "data": {
      type: "topBar",
      list: [
        { id: "0", name: '全部' },
        { id: "1", name: '出租房屋' },
        { id: "2", name: '求租房屋' },
        { id: "3", name: '出租车位' },
        { id: "4", name: '求租车位' },
        { id: "5", name: '猫狗宠物' },
        { id: "6", name: '二手家具' },
        { id: "7", name: '二手电器' },
        { id: "8", name: '二手玩具' },
        { id: "9", name: '二手书籍' },
        { id: "10", name: '健身卡片' },
        { id: "11", name: '消费卡片' },
        { id: "12", name: '二手小物品' },
        { id: "13", name: '其他物品' }
      ]
    }
  })
});
if (express.uniRouter) {
  express.uniRouter.push({
    name: "我的标签明细",
    type: "get",
    url: "/api/my/topBar/detail"
  });
}
router.get("/api/my/topBar/detail", function (req, res, next) {
  if (req.query.page){}else{
    req.query.page = 0;
  }
  if (req.query.id && parseInt(req.query.id) < '4' && parseInt(req.query.page) < '4') {
    res.json({
      "code": 0,
      "data": {
        type: "",
        id: req.query.id,
        list: [
          {
            avatar: "/data/my.png",//头像
            username: "用户昵称(" + req.query.page+")",
            title: "租房",
            totalPrice: "299.00",//总价格
            hopePrice: "299.00",//希望价格
            type: "有房找室友",//类型
            body: "已经找到房屋，找人一起分担",//标题
            position: "",//定位
            address: "",//地址
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page+")",
            title: "求租",
            type: "无房找室友",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page+")",
            title: "租房",
            type: "找室友一起租房",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",//头像
            username: "用户昵称(" + req.query.page+")",
            title: "租房",
            totalPrice: "299.00",//总价格
            hopePrice: "299.00",//希望价格
            type: "有房找室友",//类型
            body: "已经找到房屋，找人一起分担",//标题
            position: "",//定位
            address: "",//地址
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page+")",
            title: "求租",
            type: "无房找室友",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page+")",
            title: "租房",
            type: "找室友一起租房",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",//头像
            username: "用户昵称(" + req.query.page+")",
            title: "租房",
            totalPrice: "299.00",//总价格
            hopePrice: "299.00",//希望价格
            type: "有房找室友",//类型
            body: "已经找到房屋，找人一起分担",//标题
            position: "",//定位
            address: "",//地址
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page+")98",
            title: "求租",
            type: "无房找室友",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
          {
            avatar: "/data/my.png",
            username: "用户昵称(" + req.query.page+")99",
            title: "租房",
            type: "找室友一起租房",
            body: "大姨绒毛大款2020年必须买,不买你就不行了必须买",
            attrs: "黑色",
            pprice: "299.00",
            imgUrlList: [
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
              "/data/Children1.jpg",
              "/data/Children2.jpg",
              "/data/Children3.jpg",
              "/data/commodity1.jpg",
              "/data/commodity2.jpg",
              "/data/commodity3.jpg",
              "/data/commodity4.jpg",
            ],
          },
        ]
      }
    })
  } else {
    res.json({
    })
  }
});
if (express.uniRouter) {
  express.uniRouter.push({
    name: "验证是否注册",
    type: "post",
    url: "/api/registered"
  });
}
router.post('/api/registered', function (req, res, next) {
  //前端给后端的数据
  let params = {
    type: req.body.type
  };
  if (params.type==='email') {
    if (req.body.email === '282405184@qq.com') {
      res.send({
        code: 1,
        msg: "邮箱已经存在"
      })
    } else {
      res.send({
        code: 0
      })
    }
  }
  // //查询手机号是否存在
  // connection.query(user.queryUserName(params), function (error, results, fields) {
  //   if (results.length > 0) {
  //     res.send({
  //       data: {
  //         success: false,
  //         msg: "手机号已经存在"
  //       }
  //     })
  //   } else {
  //     res.send({
  //       data: {
  //         success: true
  //       }
  //     })
  //   }
  // })

})
if (express.uniRouter) {
  express.uniRouter.push({
    name: "用户登录",
    type: "post",
    url: "/api/login"
  });
}
router.post('/api/login', function (req, res, next) {
  //前端给后端的数据
  let params = {
    userName: req.body.userName,
    userPwd: req.body.userPwd
  }
  // //查询用户名或者手机号存在不存在
  // connection.query(user.queryUserName(params), function (error, results, fields) {
  //   if (results.length > 0) {
  //     connection.query(user.queryUserPwd(params), function (err, result) {
  //       if (result.length > 0) {
  //         res.send({
  //           data: {
  //             success: true,
  //             msg: "登录成功",
  //             data: result[0]
  //           }
  //         })
  //       } else {
  //         res.send({
  //           data: {
  //             success: false,
  //             msg: "密码不正确"
  //           }
  //         })
  //       }
  //     })
  //   } else {
  //     res.send({
  //       data: {
  //         success: false,
  //         msg: "用户名或手机号不存在"
  //       }
  //     })
  //   }
  // })
});


module.exports = router;
